package com.xzy.service.impl;

import com.xzy.custom.Page;
import com.xzy.entities.BookRepertory;
import com.xzy.mapper.BookRepertoryMapper;
import com.xzy.service.BookRepertoryService;
import com.xzy.web.form.BookRepertoryForm;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * TODO
 *
 * @author XiangZhongyi
 * ClassName: BookRepertoryServiceImpl
 * date: 2022/1/23 11:49
 */
@Service
public class BookRepertoryServiceImpl implements BookRepertoryService {

    @Autowired
    private BookRepertoryMapper bookRepertoryMapper;

    @Override
    public Integer findBookRepertoryCount(Page page,String name) {
        return bookRepertoryMapper.findBookRepertoryCount(page,name);
    }

    @Override
    public List<BookRepertory> findAllBookRepertory(Page page,String name) {
        return bookRepertoryMapper.findBookRepertory(page,name);
    }

    @Override
    public BookRepertory findById(Integer id) {
        return bookRepertoryMapper.findById(id);
    }

    @Override
    public void updateById(BookRepertoryForm form) {
        bookRepertoryMapper.updateById(form);
    }

    @Override
    public void insertRepertory(BookRepertoryForm form) {
        bookRepertoryMapper.insertRepertory(form);
    }

    @Override
    public void deleteById(int parseInt) {
        bookRepertoryMapper.deleteById(parseInt);
    }

    @Override
    public BookRepertory findByBookId(Integer bookId) {
        return bookRepertoryMapper.findByBookId(bookId);
    }

    @Override
    public void updateByBookId(BookRepertory bookRepertory,Integer bookId) {
        bookRepertoryMapper.updateByBookId(bookRepertory,bookId);
    }

    @Override
    public void updateQuantity(Integer quantity, Integer bookId) {
        bookRepertoryMapper.updateQuantity(quantity,bookId);
    }
}
